/*!
\copyright  Copyright (c) 2017 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\version    Part of 6.3.0
\file       adxl362.h
\brief      Header file for adxl362 accelerometer
*/

#ifndef ADXL362_PRIVATE_H
#define ADXL362_PRIVATE_H

#ifdef HAVE_ADXL362

#include <types.h>

/*! I2C communication addresses */
#define I2C_ADDRESS                (0x27)/*(0x13)*/

/*! @name ADXL362 SPI communication commands. */
//!@{
/*DA230 registers*/
#define NSA_REG_SPI_I2C                 0x00
#define NSA_REG_WHO_AM_I                0x01
#define NSA_REG_ACC_X_LSB               0x02
#define NSA_REG_ACC_X_MSB               0x03
#define NSA_REG_ACC_Y_LSB               0x04
#define NSA_REG_ACC_Y_MSB               0x05
#define NSA_REG_ACC_Z_LSB               0x06
#define NSA_REG_ACC_Z_MSB               0x07
#define NSA_REG_MOTION_FLAG				0x09
#define NSA_REG_STEPS_MSB				0x0D
#define NSA_REG_STEPS_LSB				0x0E
#define NSA_REG_G_RANGE                 0x0f
#define NSA_REG_ODR_AXIS_DISABLE        0x10
#define NSA_REG_POWERMODE_BW            0x11/*power*/
#define NSA_REG_SWAP_POLARITY           0x12
#define NSA_REG_FIFO_CTRL               0x14
#define NSA_REG_INTERRUPT_SETTINGS1     0x16
#define NSA_REG_INTERRUPT_SETTINGS2     0x17
#define NSA_REG_INTERRUPT_MAPPING1      0x19/*int1*/
#define NSA_REG_INTERRUPT_MAPPING2      0x1a
#define NSA_REG_INTERRUPT_MAPPING3      0x1b/*int2*/
#define NSA_REG_INT_PIN_CONFIG          0x20
#define NSA_REG_INT_LATCH               0x21
#define NSA_REG_ACTIVE_DURATION         0x27
#define NSA_REG_ACTIVE_THRESHOLD        0x28
#define NSA_REG_TAP_DURATION            0x2A
#define NSA_REG_TAP_THRESHOLD           0x2B
#define NSA_REG_STEP_CONGIF1			0x2F
#define NSA_REG_STEP_CONGIF2			0x30
#define NSA_REG_STEP_CONGIF3			0x31
#define NSA_REG_STEP_CONGIF4			0x32
#define NSA_REG_STEP_FILTER             0x33
#define NSA_REG_CUSTOM_OFFSET_X         0x38
#define NSA_REG_CUSTOM_OFFSET_Y         0x39
#define NSA_REG_CUSTOM_OFFSET_Z         0x3a
#define NSA_REG_ENGINEERING_MODE        0x7f
#define NSA_REG_SENSITIVITY_TRIM_X      0x80
#define NSA_REG_SENSITIVITY_TRIM_Y      0x81
#define NSA_REG_SENSITIVITY_TRIM_Z      0x82
#define NSA_REG_COARSE_OFFSET_TRIM_X    0x83
#define NSA_REG_COARSE_OFFSET_TRIM_Y    0x84
#define NSA_REG_COARSE_OFFSET_TRIM_Z    0x85
#define NSA_REG_FINE_OFFSET_TRIM_X      0x86
#define NSA_REG_FINE_OFFSET_TRIM_Y      0x87
#define NSA_REG_FINE_OFFSET_TRIM_Z      0x88
#define NSA_REG_SENS_COMP               0x8c
#define NSA_REG_SENS_COARSE_TRIM        0xd1
//!@}

/*! @name ADXL362 SPI registers. */
//!@{

//!@}

/* Bit field definitions and register values */

/*! Important note, this code assumes the compiler fills bitfields from the
    least significant bit, as KCC does, such that the following register
    bitfield definitions correctly map onto the physical bits */
#ifndef __KCC__
#warning "Not compiling with KCC. The bitfield register definitions may be incorrect."
#endif


/*! The 'on' PIO will not be controlled when __accelerometer_config.pio.on is
    set to this value */
#define ADXL362_ON_PIO_UNUSED 255

/*! The high level configuration for taking measurement */
struct __accelerometer_config
{
    /*! The I2C clock frequency */
    uint16 i2c_clock_khz;
    /*! The PIOs used to control/communicate with the sensor */
    struct
    {
        /*! PIO used to power-on the accelerometer or #ADXL362_ON_PIO_UNUSED */
        uint8 on;
        /*! Interrupt PIO driven by the accelerometer */
        uint8 interrupt;
        /*! I2C serial data PIO */
        uint8 i2c_sda;
        /*! I2C serial clock PIO */
        uint8 i2c_scl;
    } pios;
};

#endif /* HAVE_ADXL362 */
#endif /* ADXL362_PRIVATE_H */
